#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=5e4+1000;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL a[maxn],dp[maxn];
LL n,t;
deque<LL>que;
bool check(LL x){
    memset(dp,0x3f,sizeof(dp));dp[0]=0;
    que.clear();
    que.push_back(0);
    for(int i=1;i<=n;i++){
        while(!que.empty()&&i-que.front()>x+1) que.pop_front();
        dp[i]=min(dp[i],a[i]+dp[que.front()]);
        while(!que.empty()&&dp[que.back()]>=dp[i]) que.pop_back();
        que.push_back(i);
    }
//    cout<<"x="<<x<<endl;
//    for(LL i=1;i<=n;i++){
//        cout<<dp[i]<<" ";
//    }cout<<endl<<endl;
    LL ans=0x3f3f3f3f;
    for(LL i=n-x;i<=n;i++){
        ans=min(ans,dp[i]);
    }
    if(ans<=t) return true;
    else return false;
}
int main(void){
   	cin.tie(0);std::ios::sync_with_stdio(false);
    cin>>n>>t;
    for(LL i=1;i<=n;i++) cin>>a[i];
    LL l=0;LL r=n;
    while(l<r){
        LL mid=(l+r)>>1;
        if(check(mid)) r=mid;
        else l=mid+1;
    }
    cout<<l<<endl;
   	return 0;
}
